package com.atguigu.springboot.controller;

import com.atguigu.springboot.service.ISysDeptService;
import com.atguigu.springboot.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dept")
public class SysDeptController {

    @Autowired
    private ISysDeptService deptService;

    /**
     * 获取部门树
     * @return
     */
    @GetMapping("/tree")
    public R getDeptTree() {
        return R.ok(deptService.getDeptTree());
    }

    @GetMapping("/getTree")
    public R getTree() {
        return R.ok(deptService.getTree());
    }

    @GetMapping("/getTreeEx")
    public R getTreeEx() {
        return R.ok(deptService.getTreeEX());
    }
}
